package com.lin.project.hackathon.config;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Profile;
import springfox.documentation.builders.ApiInfoBuilder;
import springfox.documentation.builders.PathSelectors;
import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.service.ApiInfo;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;
import springfox.documentation.swagger2.annotations.EnableSwagger2;

/**
 * @description: 接口文档配置
 * @author: linhuaixu
 * @time: 2023/5/16 19:47
 */
@Configuration
@EnableSwagger2
@Profile("dev")
public class Knife4jConfig {
    @Bean
    public Docket defaultApi2() {
        Docket docket=new Docket(DocumentationType.SWAGGER_2)
                .apiInfo(new ApiInfoBuilder()
                        .title("hackathon")
                        .description("hackathon")
                        .version("1.0")
                        .build())
                .select()
                //指定Controller扫描包路径
                .apis(RequestHandlerSelectors.basePackage("com.lin.project.hackathon.controller"))
                .paths(PathSelectors.any())
                .build();
        return docket;
    }
}
